package com.jtjrenren.android.taxi.driver.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.jtjrenren.android.taxi.driver.Constants;
import com.jtjrenren.android.taxi.driver.bean.Order;
import com.jtjrenren.android.taxi.driver.bean.api.ApiDutyInfo;
import com.jtjrenren.android.taxi.driver.core.dutyon.WorkDutyOnActivity;
import com.jtjrenren.android.taxi.driver.core.order.finish.OrderFinishActivity;
import com.jtjrenren.android.taxi.driver.core.setting.SettingAboutActivity;
import com.jtjrenren.android.taxi.driver.core.setting.SettingActivity;
import com.jtjrenren.android.taxi.driver.core.setting.SettingFcActivity;
import com.jtjrenren.android.taxi.driver.core.setting.SettingHbActivity;
import com.jtjrenren.android.taxi.driver.core.setting.SettingLcjdActivity;
import com.jtjrenren.android.taxi.driver.core.user.forgetpwd.UserForgetPwdActivity;
import com.jtjrenren.android.taxi.driver.core.user.register.UserRegisterActivity;
import com.jtjrenren.android.taxi.driver.core.user.rsetpwd.UserChangePwdActivity;
import com.jtjrenren.android.taxi.driver.core.wallect.WallectActivity;
import com.jtjrenren.android.taxi.driver.core.wallect.WallectTxActivity;
import com.jtjrenren.android.taxi.driver.core.wallect.WallectTxmxActivity;
import com.jtjrenren.android.taxi.driver.core.main.AppHomeActivity;
import com.jtjrenren.android.taxi.driver.core.other.AppHtmlShowActivity;
import com.jtjrenren.android.taxi.driver.core.order.history.OrderHistoryActivity;
import com.jtjrenren.android.taxi.driver.core.user.login.UserLoginActivity;
import com.jtjrenren.android.taxi.driver.core.wallect.WallectBindPayActivity;
import com.jtjrenren.android.taxi.driver.core.wallect.WallectSrmxActivity;

/**
 * Created by Administrator on 2016/3/7.
 */
public class IntentUtils {
    /**
     * 前往主页
     *
     * @param context
     */
    public static void goMainActivity(Context context) {
//        Intent intent = new Intent(context, AppMainActivity.class);
        Intent intent = new Intent(context, AppHomeActivity.class);
        context.startActivity(intent);
    }

    public static void goHtmlActivity(Activity activity, String title, String url) {
        Intent intent = new Intent(activity, AppHtmlShowActivity.class);
        intent.putExtra(AppHtmlShowActivity.EXTRAS_TITLE, title);
        intent.putExtra(AppHtmlShowActivity.EXTRAS_URL, url);
        activity.startActivity(intent);
    }


    public static void goPwdChangedActivity(Activity activity) {
        Intent intent = new Intent(activity, UserChangePwdActivity.class);
        activity.startActivity(intent);
    }

    public static void goDutyOnActivity(Activity activity) {
//        Intent intent = new Intent(activity, DutyOnActivity.class);
        Intent intent = new Intent(activity, WorkDutyOnActivity.class);
        activity.startActivity(intent);
    }

    public static void goLoginPage(Activity activity) {
        Intent intent = new Intent(activity, UserLoginActivity.class);
        activity.startActivity(intent);
    }

    public static void goSettingPage(Activity activity) {
        Intent intent = new Intent(activity, SettingActivity.class);
        activity.startActivity(intent);
    }

    public static void goOrderHistoryPage(Activity activity) {
        Intent intent = new Intent(activity, OrderHistoryActivity.class);
        activity.startActivity(intent);
    }

    public static void goWallectPage(Activity activity) {
        Intent intent = new Intent(activity, WallectActivity.class);
        activity.startActivity(intent);
    }

    public static void goAboutPage(Activity activity) {
        Intent intent = new Intent(activity, SettingAboutActivity.class);
        activity.startActivity(intent);
    }

    public static void goLcjdPage(Activity activity, ApiDutyInfo info) {
        Intent intent = new Intent(activity, SettingLcjdActivity.class);
        intent.putExtra("info", info);
        activity.startActivity(intent);
    }

    public static void goFcPage(Activity activity, ApiDutyInfo info) {
        Intent intent = new Intent(activity, SettingFcActivity.class);
        intent.putExtra("info", info);
        activity.startActivity(intent);
    }

    public static void goHbPage(Activity activity, ApiDutyInfo info) {
        Intent intent = new Intent(activity, SettingHbActivity.class);
        intent.putExtra("info", info);
        activity.startActivity(intent);
    }

    public static void goSrHistoryPage(Activity activity) {
        Intent intent = new Intent(activity, WallectSrmxActivity.class);
        activity.startActivity(intent);
    }

    public static void goTxHistoryPage(Activity activity) {
        Intent intent = new Intent(activity, WallectTxmxActivity.class);
        activity.startActivity(intent);
    }

    public static void goBindPayPage(Activity activity, int type) {
        Intent intent = new Intent(activity, WallectBindPayActivity.class);
        intent.putExtra("type", type);
        activity.startActivity(intent);
    }

    public static void goTxPage(Activity activity, int type) {
        Intent intent = new Intent(activity, WallectTxActivity.class);
        intent.putExtra("type", type);
        activity.startActivity(intent);
    }

    public static void goOrderFinishPage(Activity activity, Order order) {
        Intent intent = new Intent(activity, OrderFinishActivity.class);
        if (order != null)
            intent.putExtra("order", order);
        activity.startActivity(intent);
    }


    /**
     * 前往注册页面
     *
     * @param context
     */
    public static void goRegisterActivity(Activity context, boolean isResult) {
        Intent intent = new Intent(context, UserRegisterActivity.class);
        if (isResult)
            context.startActivityForResult(intent, Constants.CODE_ATY_REGISTER);
        else
            context.startActivity(intent);
    }

    /**
     * 前往忘记密码页面
     *
     * @param context
     * @param isResult
     */
    public static void goForgetPwdActivity(Activity context, boolean isResult) {
        Intent intent = new Intent(context, UserForgetPwdActivity.class);
        if (isResult)
            context.startActivityForResult(intent, Constants.CODE_ATY_FORGETPWD);
        else
            context.startActivity(intent);
    }
}
